package org.jdsm.flow.gxt.users.client;

/**
 * Created by IntelliJ IDEA.
 * User: mikom
 * Date: 12.03.11
 * Time: 23:02
 */
public abstract class ResultCallbackSenderForRequest extends RequestCallbackSender{

    private String message;
    private String errorMessage;
    private String result;


    public String getMessage() {
        if(message == null && getJSONResult() != null)
        message = getJSONResult().isObject().get("response").isObject().get("message").toString();
        return message;
    }

    public String getErrorMessage() {
        if(errorMessage == null && getJSONResult() != null)
        errorMessage = getJSONResult().isObject().get("response").isObject().get("errorMessage").toString();
        return errorMessage;
    }

    public String getResult() {
        if(result == null && getJSONResult() != null)
        result = getJSONResult().isObject().get("response").isObject().get("result").toString();
        return result;
    }
}
